<?php
namespace app\api\controller;
use think\Validate;

class Attachment extends Api
{
	public function _initialize() {
        parent::_initialize();
        $this->model = model('attachment/attachment', 'service');
    }
	/* 发送验证码 */
	public function upload(){
        $file = $this->request->file('file');
        $result = $this->model->upload($file, $this->params['folder']);
        if($result === false) {
            return $this->response($this->model->getError(), $result, -21001);
        }
        return $this->response(lang('Operation completed'), $result);
	}
}